let interstitialAd = null;
export const $interstitialAd = {
	init: (ad_id) => {
		if (wx.createInterstitialAd) {
			interstitialAd = wx.createInterstitialAd({ adUnitId: ad_id })
			interstitialAd.onLoad(() => {
				console.log('onLoad event emit')
			})
			interstitialAd.onError((err) => {
				console.log('onError event emit', err)
			})
			interstitialAd.onClose((res) => {
				console.log('onClose event emit', res)
			})
		}
	},

	show: () => {
		if (interstitialAd) {
			interstitialAd.show().catch((err) => {
				console.error('插屏广告显示失败', err)
			})
		}
	}

}